Skip to content

Conversation

@jkhusanov
Copy link
Collaborator

@jkhusanov jkhusanov commented Mar 5, 2025

  • BREAKING CHANGES

    • Handle crashes when not a finite number (i.e., NaN, Infinity, or -Infinity) numeric props were passed to the component by overriding them with default values
      • Display new warning component in production, it can be overridden with new dataErrorComponent prop
      • Display warnings in dev mode
      • Return errors with new onDataError prop that accepts a callback function
  • Fixes component height when arcDegree prop is higher than 180 degrees

  • Update example project to latest React Native version 0.78

crosenfrisk and others added 24 commits July 30, 2024 10:16
…led-prop-type-undefined-in-SegmentedArc

Remove .isRequired from emptyColor prop and add default value to emptyColor
…b1fecet/Failed-prop-type-undefined-in-SegmentedArc

Restored .isRequired
Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 4.3.6 to 4.4.1.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](NaturalIntelligence/fast-xml-parser@v4.3.6...v4.4.1)

---
updated-dependencies:
- dependency-name: fast-xml-parser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jakhongir Khusanov <[email protected]>
Bumps [serve-static](https://github.com/expressjs/serve-static) from 1.14.1 to 1.16.0.
- [Release notes](https://github.com/expressjs/serve-static/releases)
- [Changelog](https://github.com/expressjs/serve-static/blob/master/HISTORY.md)
- [Commits](expressjs/serve-static@v1.14.1...1.16.0)

---
updated-dependencies:
- dependency-name: serve-static
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6.
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](moxystudio/node-cross-spawn@v7.0.3...v7.0.6)

---
updated-dependencies:
- dependency-name: cross-spawn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…rash (#114)

* Handle possible invalid scale input

* Show warnings about invalid segment props

* Handle segments with invalid arcDegreeScale

* Update Segment Arc component to use the new function

* Handle the scale sum with default values to avoid NaN or Infinite values

* Allow to show the same warning message for different component instance

* Remove duplicated tests

* Handle potential warning on floating point sum

* Test ensureDefaultSegmentScaleValues

* Improve test description

* Rename strings to the suggested on review

* Rename private functions including underscore

* Move internal functions to the top and and apply undescore

* Simplify math operations

* Add segments test input as a local variable

* Add test to prevent multiple warnings being shown on rerender

* Add showWarning function

* Stop using showWarningOnce on segments warnings and use showWarning

* Remove unecessary showWarningOnce

* Make new props more obvious

* Calculate the number of invalid segments

* Improve warning message to be clear the invalid value is from the segments prop

* Create Data Error component

* Show data error component on invalid data

* Add docs about dataErrorComponent

* Revert: Calculate the number of invalid segments

Ensure invalid segments are returned in their original order.
Default values remain unchanged.

* Return all invalid segments to be able to pass to an error callback

* Add onDataError callback

* Move settings callbackRef.current to useEffect to respect the rules of react

* Improve Data error component to have the same width of the graph to not cause any ui issue

* Fix snapshot

* Add style props to DataErrorRenderer

* Split tests and add test to cover removal of segments

* Fix spacing

* Rename scale to scaleHelpers

* Update test to be moremeaningful and cover JSX Element

* Update comment

* Update README with suggested values

* Add it

* Throw an error if dataErrorComponent is not null, jsx element or undefined

* Return null if invalid props is passed to the data error component

* Change again
…rrectly (#116)

* fix

* chore(test) - Update snapshots
* Handle possible invalid scale input

* Show warnings about invalid segment props

* Handle segments with invalid arcDegreeScale

* Update Segment Arc component to use the new function

* Handle the scale sum with default values to avoid NaN or Infinite values

* Allow to show the same warning message for different component instance

* Remove duplicated tests

* Handle potential warning on floating point sum

* Test ensureDefaultSegmentScaleValues

* Improve test description

* Rename strings to the suggested on review

* Rename private functions including underscore

* Move internal functions to the top and and apply undescore

* Simplify math operations

* Add segments test input as a local variable

* Add test to prevent multiple warnings being shown on rerender

* Add showWarning function

* Stop using showWarningOnce on segments warnings and use showWarning

* Remove unecessary showWarningOnce

* Make new props more obvious

* Calculate the number of invalid segments

* Improve warning message to be clear the invalid value is from the segments prop

* Create Data Error component

* Show data error component on invalid data

* Add docs about dataErrorComponent

* Revert: Calculate the number of invalid segments

Ensure invalid segments are returned in their original order.
Default values remain unchanged.

* Return all invalid segments to be able to pass to an error callback

* Add onDataError callback

* Move settings callbackRef.current to useEffect to respect the rules of react

* Improve Data error component to have the same width of the graph to not cause any ui issue

* Fix snapshot

* Add style props to DataErrorRenderer

* Split tests and add test to cover removal of segments

* Fix spacing

* Rename scale to scaleHelpers

* Update test to be moremeaningful and cover JSX Element

* Update comment

* Update README with suggested values

* Add it

* Throw an error if dataErrorComponent is not null, jsx element or undefined

* Return null if invalid props is passed to the data error component

* Change again

* Parse any numeric props in a safer way and set the default value if NaN

* Revert "Remove unecessary showWarningOnce"

This reverts commit 6fa53ae.

* Remove unecessary warnId

* Remove unecessary variable

* Add clearAllWarnings to afterEach to isolate tests

* Do not parse variables not used in math operations

* Revert "Revert "Remove unecessary showWarningOnce""

This reverts commit 392e81b.

* Handle errors for invalid numeric props

* Rename hook to useDataErrorCallback

* Do not allow Infinity because it also causes a crash

* Add test to be sure nobody will forget to pass the dependency to useMemo

* Remove SegmentedArcBase

* Improve tests

* rename private functions

* Update test description

* Remove unecessary handling for undefined propertyName

---------

Co-authored-by: Jakhongir Khusanov <[email protected]>
* Upgrade RN version to 0.78"

* format with prettier

* remove test
@jkhusanov jkhusanov requested a review from taylorcore as a code owner March 5, 2025 22:13
@jkhusanov jkhusanov merged commit 4f0b6be into main Mar 10, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants